<?php

$this->extend('/Common/admin_edit');

$this->Html
	->addCrumb('', '/admin', array('icon' => 'home'))
	->addCrumb(__('Countries'), array(
		'plugin' => 'countries', 'controller' => 'countries', 'action' => 'index'));

if ($this->request->params['action'] == 'admin_edit') {
	$this->Html->addCrumb($this->data['Country']['name'], array(
		'plugin' => 'countries', 'controller' => 'countries', 'action' => 'edit',
		$this->params['pass'][0]
	));
}

if ($this->request->params['action'] == 'admin_add') {
	$this->Html->addCrumb(__('Add'), $this->here);
}

?>
<?php echo $this->Form->create('Country');?>

<div class="row-fluid">
	<div class="span8">

		<ul class="nav nav-tabs">
			<li><a href="#country-main" data-toggle="tab"><?php echo __('Country'); ?></span></a></li>
			<li><a href="#country-params" data-toggle="tab"><?php echo __('Params'); ?></a></li>
			<?php echo $this->Croogo->adminTabs(); ?>
		</ul>

		<div class="tab-content">
			<div id="country-main" class="tab-pane">
			<?php				
				echo $this->Form->input('id');
				$this->Form->inputDefaults(array(
					'label' => false,
					'class' => 'span10',
				));
				echo $this->Form->input('name', array(
					'placeholder' => __('Name'),
				));
				echo $this->Form->input('alias', array(
					'placeholder' => __('Alias'),
				));
				$limit_fields = json_decode(Configure::read('Countries.country_fields'));
				if(in_array('code',$limit_fields)){
					echo $this->Form->input('code', array(
						'placeholder' => __('Code'),
					));		
				}
			?>
			</div>

			<div id="country-params" class="tab-pane">
			<?php
				echo $this->Form->input('Country.params', array(
					'placeholder' => __('Params'),
				));
			?>
			</div>			
			
			<?php echo $this->Croogo->adminTabs(); ?>
		</div>
	</div>

	<div class="span4">
		<?php
			echo $this->Html->beginBox(__('Publishing')) .
				$this->Form->button(__('Apply'), array('name' => 'apply', 'button' => 'default')) .
				$this->Form->button(__('Save'), array('button' => 'default')) .
				$this->Html->link(__('Cancel'), array('action' => 'index'), array('button' => 'danger')) .
				$this->Form->input('status', array(
					'label' => __('Status'),
					'class' => false,
				)).
				$this->Html->endBox();
			echo $this->Croogo->adminBoxes();
		?>
	</div>

</div>
<?php echo $this->Form->end(); ?>